var text = "article-detail-text";
const format = (txt) => {
  return txt.replace(/-(\w)/g, (x1, x2, x3) => {
    console.log(x1, x2, x3);
    // return x1.slice(1).toUpperCase();
    return x2.toUpperCase();
  });
};
console.log(format(text));

const text2 = "myReceHeatKaty";
const camelToUnderline = (txt) => {
  return txt.replace(/[A-Z]/g, (x1, x2) => {
    return `_${x1.toLowerCase()}`;
  });
};
console.log(camelToUnderline(text2));
